package model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.ForeignKey;

@Entity
@Table(name="modelo_veiculo")
public class ModeloVeiculo implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	@Column
	private Integer ano;

	@Column(length=30, nullable=false)
	private String nome;

	@ManyToOne
	@ForeignKey(name="fk_marca")
	@JoinColumn(name="marca")
	private MarcaVeiculo marcaVeiculo;

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getAno() {
		return this.ano;
	}

	public void setAno(Integer ano) {
		this.ano = ano;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public MarcaVeiculo getMarcaVeiculo() {
		return this.marcaVeiculo;
	}

	public void setMarcaVeiculo(MarcaVeiculo marcaVeiculo) {
		this.marcaVeiculo = marcaVeiculo;
	}
	
	@Override
	public String toString(){
		return this.nome + " - " + this.ano;
	}
}